package com.metrology.app.biz;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.core.GrantedAuthority;

import com.metrology.app.domain.AdminUser;

import com.metrology.app.domain.AdminResource;
import com.metrology.app.domain.AdminRole;
import com.metrology.common.exception.AppBusinessException;
import com.metrology.common.page.PageModel;


public interface AdminBiz {

	public Collection<GrantedAuthority> loadUserAuthoritiesByUsername(
			String username) throws AppBusinessException;

	public AdminUser loadUserByUsername(String username)
			throws AppBusinessException;

	public Map<String, Collection<ConfigAttribute>> loadResourceDefine()
			throws AppBusinessException;

	public Collection<ConfigAttribute> loadAllConfigAttribute()
			throws AppBusinessException;

	public PageModel getAdminUserList(Integer page) throws AppBusinessException;

	public PageModel getAdminResourceList(Integer page)
			throws AppBusinessException;

	public PageModel getAdminRoleList(Integer page) throws AppBusinessException;

	public List<AdminRole> getAdminRole() throws AppBusinessException;

	public List<AdminResource> getAdminResource() throws AppBusinessException;

	public List<AdminRole> getAdminUserRole(String id) throws AppBusinessException;

	public void insertUser(AdminUser user) throws AppBusinessException;

	public void insertRole(AdminRole role) throws AppBusinessException;

	public void insertResource(AdminResource resource)
			throws AppBusinessException;

	public void deleteUser(String userId) throws AppBusinessException;

	public void deleteRole(String roleId) throws AppBusinessException;

	public void deleteResource(String resourceId) throws AppBusinessException;

	public void updateUser(AdminUser user) throws AppBusinessException;

	public void updateRole(AdminRole role) throws AppBusinessException;

	public void updateResource(AdminResource resource)
			throws AppBusinessException;

	public void updateUserRole(String arrRoleList, String userId)
			throws AppBusinessException;

	public void insertUserRoleId(String userId, String roleId)
			throws AppBusinessException;

	public List<AdminResource> getAdminRoleResource(String id)
			throws AppBusinessException;

	public void updateRoleResource(String arrResourceList, String roleId)
			throws AppBusinessException;

	public void insertUserResourceId(String resourceId, String roleId)
			throws AppBusinessException;

	public AdminUser getUserById(String id) throws AppBusinessException;

	public AdminRole getRoleById(String id) throws AppBusinessException;

	public AdminResource getResourceById(String id) throws AppBusinessException;
	
	/**
	 * @param userId	用户ID
	 * @return	查询用户的资源
	 * @throws AppBusinessException
	 */
	List<AdminResource> getResourceByUser(String userId) throws AppBusinessException;
	
}
